package cn.iocoder.yudao.module.system.dal.mysql.workhanging;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.workhanging.WorkHangingDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.workhanging.vo.*;

/**
 * 下挂记录 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface WorkHangingMapper extends BaseMapperX<WorkHangingDO> {

    default PageResult<WorkHangingDO> selectPage(WorkHangingPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WorkHangingDO>()
                .eqIfPresent(WorkHangingDO::getWorkId, reqVO.getWorkId())
                .eqIfPresent(WorkHangingDO::getSubgroup, reqVO.getSubgroup())
                .eqIfPresent(WorkHangingDO::getPerBoxNum, reqVO.getPerBoxNum())
                .eqIfPresent(WorkHangingDO::getRejectsNum, reqVO.getRejectsNum())
                .eqIfPresent(WorkHangingDO::getBoxNum, reqVO.getBoxNum())
                .betweenIfPresent(WorkHangingDO::getHangTime, reqVO.getHangTime())
                .eqIfPresent(WorkHangingDO::getTotalQuantity, reqVO.getTotalQuantity())
                .eqIfPresent(WorkHangingDO::getBadPhenomenon, reqVO.getBadPhenomenon())
                .betweenIfPresent(WorkHangingDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WorkHangingDO::getId));
    }

}